# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=radcli
pkgver=1.3.1
pkgrel=0
pkgdesc="A simple RADIUS client library"
url="https://github.com/radcli/radcli"
arch="all"
license="BSD-2-Clause AND MIT"
makedepends="
	gnutls-dev
	linux-headers
	"
checkdepends="bash"
subpackages="
	$pkgname-compat-dev:_compat
	$pkgname-dev
	$pkgname-doc
	"
source="https://github.com/radcli/radcli/releases/download/$pkgver/radcli-$pkgver.tar.gz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-rpath \
		--enable-legacy-compat \
		--without-nettle \
		--with-tls
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	cp -p "$pkgdir"/usr/share/$pkgname/dictionary "$pkgdir"/etc/$pkgname/
}

_compat() {
	pkgdesc="Development filees for compatibility with radiusclient-ng and freeradius-client"

	amove usr/include/freeradius-client.h
	amove usr/include/radiusclient-ng.h
	amove usr/lib/libfreeradius-client.so
	amove usr/lib/libradiusclient-ng.so
}

sha512sums="
12f8e7905ae128354b6c8ab302b444c31a5cf82256dddd747640e140832079d457f3ac88cae20eb5cf7dfff034e23f1f9229e6834540b8771357000544000a15  radcli-1.3.1.tar.gz
"
